package tec;

class TestEtatPassager {

    void lancer() {
	int nbTest = 0;
	System.out.println("Test de EtatPasssager :");
	System.out.print(".");
	testAssis(); nbTest++; 
	System.out.print(".");
	testDebout(); nbTest++;
	System.out.print(".");
	testExterieur(); nbTest++;	
	System.out.print(".");
	testInterieur(); nbTest++;
	
	System.out.println("OK (" + nbTest + ")");
    }
    
    void testExterieur() {
	// Declaration de la variable + instanciation
	EtatPassager aTester = new EtatPassager(Etat.DEHORS);
	assert (!aTester.estAssis() 
		&& !aTester.estDebout() 
		&& aTester.estExterieur());
	    System.out.println("Test Exterieur : ok");
    }
    
    void testAssis() {
	EtatPassager aTester = new EtatPassager(Etat.ASSIS);
	assert aTester.estAssis() ;
	assert !aTester.estDebout(); 
	assert !aTester.estExterieur();
	    System.out.println("Test Assis : ok");
    }

    void testDebout() {
	EtatPassager aTester = new EtatPassager(Etat.DEBOUT);
	assert !aTester.estAssis() ;
	assert aTester.estDebout(); 
	assert !aTester.estExterieur();
	    System.out.println("Test Debout : ok");
    }

    void testInterieur() {
	EtatPassager aTester = new EtatPassager(Etat.DEBOUT);
	assert aTester.estAssis() || aTester.estDebout(); 
	assert !aTester.estExterieur();

	aTester = new EtatPassager(Etat.ASSIS);
	assert aTester.estAssis() || aTester.estDebout(); 
	assert !aTester.estExterieur();
	System.out.println("Test Intérieur : ok");
    }

    private void jeVeuxVrai (boolean expr, String msg){
	assert expr : "\nECHEC jeVeuxVrai <" + msg + ">";
    }

    private void jeVeuxFaux (boolean expr, String msg){
	assert !expr : "\nECHEC jeVeuxFaux <" + msg + ">";
    }
}
